﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace SMS_Gateway
{
    public class SMSContact
    {
        static string PhoneRegex = "^(?:(?:012)|(?:011)|(?:010))[0-9]{8}$";

        private Boolean IsValid(String Number)
        {
            return Regex.IsMatch(Number, PhoneRegex);
        }

        string _number;
        public String Number
        {
            get
            {
                return _number;
            }
            set
            {
                if (IsValid(value))
                {
                    _number = value;
                }
                else
                {
                    throw new Exception("Wrong Number");
                }

            }
        }

        public String InternationalizedNumber
        {
            get
            {
                return "+2" + Number;
            }
        }
     
        public SMSContact(String number)
        {
            Number = number;
        }

        internal static bool IsValid(SMSContact cont)
        {
            // TODO: Implement
            return true;
        }
    }
}
